<div id="guideBar">
    <a href="/home/index/<%=@sender.id%>">去<b><%=@sender.username%></b>的主页</a> | <a href="/home/index/<%=@receiver.id%>">去<b><%=@receiver.username%></b>的主页</a>
</div>
<div id="chat">
    <div id="myWall">
    <% if (session[:user].id.to_s==@params[:id]) or (session[:user].id.to_s==@params[:friend_id]) %>
        <%= javascript_include_tag :fckeditor %>
        <script type="text/javascript">
        window.onload = function()
        {
            var oFCKeditor = new FCKeditor('message_content', '100%', '120', 'Basic', '' );
            oFCKeditor.ReplaceTextarea();
        }
        </script>
        <!--发送表单-->
        <%= form_tag(:controller => "message",:action => "sendChatMessage")%>
        <table class="wallPostForm" width="100%" cellspacing="3" cellpadding="0">
            <tr>
                <td>
                    <% if @quoteMessage %>
                    <div class="wallQuoteDisplay">
    					<strong>引用内容:</strong>
    					<div class="wallQuoteFromDisplay">
    					<%=@quoteMessage.sender.username %> <%=@quoteMessage.sendDatetime.strftime("%Y-%m-%d %I:%M%p")%> 说道
    					</div>
    					<div class="wallQuoteContentDisplay">
    					<%=@quoteMessage.content %>
    					</div>
    				</div>
    				<%=hidden_field(:message, :quote_message_id, :value=>@quoteMessage.id)%>
    				<% elsif @quotePost %>
                    <div class="wallQuoteDisplay">
    					<strong>所回复的信息广场内容:</strong>
    					<div class="wallQuoteFromDisplay">
    					标题：<a href="/square/post/<%=@quotePost.id %>"><%=@quotePost.title %></a>
    					<%=@quotePost.poster.username %> <%=@quotePost.postDatetime.strftime("%Y-%m-%d %I:%M%p")%> 说道
    					</div>
    					<div class="wallQuoteContentDisplay">
    					<%=@quotePost.content %>
    					</div>
    				</div>
    				<%=hidden_field(:message, :quote_post_id, :value=>@quotePost.id)%>
    				<% end %>
                </td>
            </tr>
            <tr>
                <td>
                    <%= text_area "message","content",:cols=>77,:rows=>4 %>                                               
                </td>
            </tr>
            <tr>
                <td>                    
                    <label for="message_isPrivate">
                         <%= check_box("message","isPrivate",{},"true", "false") %>私秘
                    </label>
                    <%= submit_tag "提交",:class=>"btn"%>
                </td>
            </tr>
        </table>
        <!--在别人的主页，当前用户的留言，friend_id是自己,id是对方的时候-->
        <% if session[:user].id.to_s==@params[:friend_id] %>
            <%=hidden_field(:message, :receiver_id, :value=>@params[:id])%>
        <% else %>
            <%=hidden_field(:message, :receiver_id, :value=>@params[:friend_id])%>
        <% end %>
        <%= end_form_tag %>
    <% end %>
        <br>
        <div id="wallPosts">
    		<%=render_partial("messageList")%>
        </div>
        <div class="pager">
            <ul>
                <% for page in @message_pages %>
                    <%=
                    if page==@message_pages.current()
                        "<li class='currentPage'>#{page.number}</li>"
                    else
                        "<li><a href = '#{@params[:id]||id}?friend_id=#{@params[:friend_id]}&page=#{page.number}' >#{page.number}</a></li>"
                    end
                    %>
                <% end %>
            </ul>
        </div>
    </div>
</div>